package com.ethink.warehouse.api.request;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigDecimal;
import java.util.List;

/**
 * 入库、出口申请 新增请求对象
 *
 * @author default
 * @date 2022-11-10
 */
@Data
public class LogisticsTraceApplyAddRequest {

    @Schema(description = "枚举 订单类型:1-入库(t1)|2-出库(t2)")
    private Integer orderType;
    @Schema(description = "原始单号")
    private String sourceOrderNo;
    @Schema(description = "原始订单类型")
    private String sourceOrderType;
    @Schema(description = "科目")
    private String subject;

    @Schema(description = "申请人账号")
    private String createUserCode;
    @Schema(description = "申请人名称")
    private String createUserName;
    @Schema(description = "相关单位编码")
    private String companyCode;
    @Schema(description = "相关单位名称")
    private String companyName;

    private List<T11Item> t11Items;
    private List<T12Item> t12Items;
    private List<SaleCkItem> saleCkItems;
    private List<SaleReturnRkItem> saleReturnRkItems;

    private Boolean lock;

    @Data
    public static class T11Item {
        // 采购入库
        @Schema(description = "原始详单号")
        private String sourceDetailOrderNo;
        @Schema(description = "初始分仓编码")
        private String subWarehouseCode;
        @Schema(description = "商品SKU")
        private String mateSku;
        @Schema(description = "枚举 库存类型:1-正品(zp)|2-瑕疵(cc)")
        private Integer inventoryType;
        @Schema(description = "提交申请数量")
        private Integer applyInQty;
        private String saleSubChannel;
        @Schema(description = "采购单号")
        private String purchaseOrderNo;
        @Schema(description = "采购详单号")
        private String purchaseDetailOrderNo;
        private BigDecimal costPrice;

    }

    @Data
    public static class T12Item {
        // 采购退货
        @Schema(description = "原始详单号")
        private String sourceDetailOrderNo;
        @Schema(description = "提交申请数量")
        private Integer applyInQty;
        @Schema(description ="库存主键")
        private Long mateInventoryId;
    }

    @Data
    public static class SaleCkItem {
        // 销售出库
        @Schema(description = "原始详单号")
        private String sourceDetailOrderNo;
        @Schema(description = "提交申请数量")
        private Integer applyInQty;
        @Schema(description ="库存主键")
        private Long mateInventoryId;
        // 调拨
        /** 目的分仓编码 */
        private String targetSubWarehouseCode;
        private String targetSubWarehouseName;
    }

    @Data
    public static class SaleReturnRkItem {
        // 预售，销售退货入库
        @Schema(description = "原始详单号")
        private String sourceDetailOrderNo;
        @Schema(description = "初始分仓编码")
        private String subWarehouseCode;
        @Schema(description = "商品SKU")
        private String mateSku;
        @Schema(description = "枚举 库存类型:1-正品(zp)|2-瑕疵(cc)")
        private Integer inventoryType;
        private String saleSubChannel;
        @Schema(description = "提交申请数量")
        private Integer applyInQty;

    }
}
